package com.study.spmongodb.wwj.thread2.char01;

/**
 * @author MI
 * @version 1.0
 * @date 2020/12/6 20:41
 */
public class SingletObject5 {

    //防止指令重排
    private static volatile SingletObject5 instance;

    private SingletObject5() {
    }

    public static SingletObject5 getInstance() {
        if (null == instance) {
            synchronized (SingletObject5.class) {
                if (null == instance) {
                    instance = new SingletObject5();
                }
            }
        }
        return instance;
    }
}
